
<%@ page import="Biblioteca.Emprestimo" %>

<html>
    <head>
	    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
       <g:if test="${tipoUsuario == 'Admin'}">
        	<meta name="layout" content="adminBiblioteca" />
        </g:if>
        <g:else>
        	<meta name="layout" content="usuarioBiblioteca" />
        </g:else>
        <g:set var="entityName" value="${message(code: 'emprestimo.label', default: 'Emprestimo')}" />
        <title><g:message code="SPL - Emprestimos" args="[entityName]" /></title>
    </head>
    <body>
        <div class="body">
            <h1><g:message code="Visualizando Emprestimo" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <div class="dialog">
                <table>
                    <tbody>
                    	
                    	<tr class="prop">
                            <td valign="top" class="name"><g:message code="emprestimo.login.label" default="Login" /></td>
                            
                            <td valign="top" class="value">${fieldValue(bean: emprestimoInstance, field: "login")}</td>
                            
                        </tr>
                    	
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="emprestimo.dataEmprestimo.label" default="Data de Emprestimo" /></td>
                            
                            <td valign="top" class="value"><g:formatDate date="${emprestimoInstance?.dataEmprestimo}" /></td>
                            
                        </tr>                 	
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="emprestimo.dataDevolucao.label" default="Data de Devolucao" /></td>
                            
                            <td valign="top" class="value"><g:formatDate date="${emprestimoInstance?.dataDevolucao}" /></td>
                            
                        </tr>

                         <tr class="prop">
                            <td valign="top" class="name"><g:message code="emprestimo.valido.label" default="Validade" /></td>

                             <td valign="top" class="value">${fieldValue(bean: emprestimoInstance, field: "valido")}</td>

                        </tr>
                    		
                    	<tr class="prop">
                    		<td valign="top" class="name"><g:message code="emprestimo.list.label" default="Item Emprestado" /></td>
                    		<td valign="top" class="value">
                    			 <span class = "actionButton">
                    			 			<g:if test="${tipo == 'livro'}">
                    			 				<% def urlAux = "/SPL_V3/livro/show/" +  emprestimoInstance.idItem %>
                            					<g:link url="${urlAux}">${nome_item}</g:link><br></br>
                    			 			</g:if>
                    			 			<g:else>
                    			 				<% def urlAux = "/SPL_V3/relatorioTecnico/show/" +  emprestimoInstance.idItem %>
                            					<g:link url="${urlAux}">${nome_item}</g:link><br></br>
                    			 			</g:else>
                    			 		                       			 			
                            	 </span>
                    		</td>
                    	</tr>	
                    	
                    </tbody>
                </table>
            </div>
            <div class="buttons">
                <g:form>
                    <g:hiddenField name="id" value="${emprestimoInstance?.id}" />
                    <!--  <span class="button"><g:actionSubmit class="edit" action="edit" value="${message(code: 'Editar dados' )}" /></span>-->
                    <g:if test="${tipoUsuario == 'Admin'}">
                    <span class="button"><g:actionSubmit class="delete" action="devolucao" value="${message(code: 'Efetuar Devolução')}" onclick="return confirm('${message(code: 'Voc� tem certeza?', default: 'Voc� tem certeza?')}');" /></span>
                    </g:if>
                </g:form>
            </div>
        </div>
    </body>
</html>
